﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.Entity.ModelConfiguration;
using System.ComponentModel.DataAnnotations;

namespace ERPStore.NewsLetters.Repositories.Mapping
{
	internal class TrackMap : EntityTypeConfiguration<Datas.TrackData>
	{
		public TrackMap()
		{
			this.HasKey(e => e.Id);
			this.Property(e => e.Id)
				.IsRequired()
				.HasDatabaseGeneratedOption(System.ComponentModel.DataAnnotations.Schema.DatabaseGeneratedOption.Identity);

			this.Property(e => e.CreationDate)
				.IsRequired();
			this.Property(e => e.EventDate)
				.IsRequired();
			this.Property(e => e.CampaingId)
				.IsRequired();
			this.Property(e => e.Email)
				.IsRequired()
				.HasMaxLength(200);
			this.Property(e => e.LinkName)
				.IsOptional()
				.HasMaxLength(200);
			this.Property(e => e.NewsLetterId)
				.IsRequired();
			this.Property(e => e.UserId)
				.IsOptional();
			this.Property(e => e.Ip)
				.HasMaxLength(40)
				.IsOptional();
			this.Property(e => e.Url)
				.HasMaxLength(2048)
				.IsOptional();
			this.Property(e => e.DestinationUrl)
				.HasMaxLength(2048)
				.IsOptional();
			this.Property(e => e.EmailSentId)
				.IsOptional();

			this.ToTable("NewsLetterTrack");

		}
	}
}
